#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Time    : 2025/4/18 15:10
@Author  : HZP
@File    : 1.LLM与ChatModel使用技巧.py
"""
from dotenv import load_dotenv
from langchain.prompts import ChatPromptTemplate
from langchain_openai import ChatOpenAI

load_dotenv()
chatOpenAi = ChatOpenAI(
    temperature=0.6,
    model="qwq"
)

prompt_key = ChatPromptTemplate.from_messages([
    ("system", "你是一个很厉害的程序员,请回答用户的问题."),
    ("user", "{answer}")
])
prompt = prompt_key.invoke({"answer": "接口模式讲解?"})
ai_message = chatOpenAi.invoke(prompt)

print(ai_message.content)
